Sub ZKonekey()
' Sample_count是样品编号为001还是01，及百位或十位表示
Dim Sample_count as Integer
' 指定样品编号格式，百位则为16，十位则为15
Sample_count = 15
' 定义不同样品编号所含关键字
'指定质控表分析项目，是否含有铜、锌、铬、镍
Dim haveCu as Boolean
Dim haveZn as Boolean
Dim haveCr as Boolean
Dim haveNi as Boolean

haveCu = 1
haveZn = 1 
haveCr = 1
haveNi = 1

Dim blank As String
Dim parallel As String
Dim zk As String
Dim staAdd As String
Dim midpoint As String

blank = "空白"
parallel = "PX"
zk = "GBW"
staAdd = "JB"
midpoint = "QC"

' 初始化不同样品编号出现次数
Dim blank_num As Integer
Dim parallel_num As Integer
Dim zk_num As Integer
Dim staAdd_num As Integer
Dim midpoint_num As Integer
Dim sample_num As Integer

blank_num = 0
parallel_num = 0
zk_num = 0
staAdd_num = 0
midpoint_num = 0


' -------------------以上为判断数量部分----------------------

Dim id_array(1 To 999) As String
Dim para_dict as Object
Set para_dict = CreateObject("scripting.dictionary")
Dim blank_dict as Object
Set blank_dict = CreateObject("scripting.dictionary")
Dim zk_dict as Object
Set zk_dict = CreateObject("scripting.dictionary")
Dim staAdd_dict as Object
Set staAdd_dict = CreateObject("scripting.dictionary")
Dim midpoint_dict as Object
Set midpoint_dict = CreateObject("scripting.dictionary")

'遍历序列表，判空白、加标、平行等数量
For i = 1 To 999 Step 1

    id_array(i) = Sheets("序列").Range("A" & i).Value
    
    If checkString(id_array(i), blank) = True Then
        blank_num = blank_num + 1
        blank_dict(id_array(i)) = i
    End If
    If checkString(id_array(i), parallel) = True Then
        parallel_num = parallel_num + 1
        ' 记录下平行样B的行号，字典的结构为 “EN20222222222-01PX：1”
        para_dict(id_array(i)) = i
    End If
    If checkString(id_array(i), zk) = True Then
        zk_num = zk_num + 1
        zk_dict(id_array(i)) = i
    End If
    If checkString(id_array(i), staAdd) = True Then
        staAdd_num = staAdd_num + 1
        staAdd_dict(id_array(i)) = i

    End If
    If checkString(id_array(i), midpoint) = True Then
        midpoint_num = midpoint_num + 1
        midpoint_dict(id_array(i)) = i

    End If
    If id_array(i) = "END" Then
    	sample_num = I - 2 - blank_num - parallel_num - zk_num - staAdd_num - midpoint_num
    End If
Next

' sample_num = UBound(id_array) - LBound(id_array) + 1 - blank_num - parallel_num - zk_num - staAdd_num - midpoint_num

Range("A49").value =  "此批样品中空白有 " & blank_num & " 个； " & "平行有: " & parallel_num & "个； " & "质控有： " & zk_num & "个； " & "加标有: " & staAdd_num & " 个； " & "QC有： " & midpoint_num & " 个 ； " & " 共有：" & sample_num & "个样品。"
' MsgBox "parallel_num:" & parallel_num
' MsgBox "zk_num:" & zk_num
' MsgBox "staAdd_num:" & staAdd_num
' MsgBox "midpoint_num:" & midpoint_num

' 填写样品数量,默认填充五张质控表
Range("L3,AG3,BB3,BW3,CR3").value = "批处理样品数量：" & sample_num & " 个"

Dim Location_index
Location_index = Array("B","F","J","N","R","W","AA","AE","AI","AM","AR","AV","AZ","BD","BH","BM","BQ","BU","BY","CC","CH","CL","CP","CT","CX")

' 清理控制表

For i2 = 0 To 24 Step 1

' 清理空白值
Range(Location_index(i2) & 7 & ":" & Location_index(i2) & 10).value = ""
' 清理空白编号
Range(Location_index(i2) & 5).value = ""


' 清理平行
Range(Location_index(i2) & 14 & ":" & Location_index(i2) & 17).value = ""
Range(Location_index(i2) & 14 & ":" & Location_index(i2) & 17).Offset(0,1).value = ""

Range(Location_index(i2) & 12).value = ""

' 清理加标
Range(Location_index(i2) & 19).value = ""
Range(Location_index(i2) & 20).value = "加标量：Cu、Zn、Cr：  mg/kg  Zn:  mg/kg"
Range(Location_index(i2) & 22 & ":" & Location_index(i2) & 25).value = ""
Range(Location_index(i2) & 22 & ":" & Location_index(i2) & 25).Offset(0,1).value = ""

' 清理质控
Range(Location_index(i2) & 27).value = ""
Range(Location_index(i2) & 29 & ":" & Location_index(i2) & 32).value = ""
Next
' ---------------------以下为填写空白部分------------------------------------

Dim Cu_blank_value() as Double
Dim Ni_blank_value() as Double
Dim Zn_blank_value() as Double
Dim Cr_blank_value() as Double
ReDim Cu_blank_value(0 To blank_num - 1) As Double
ReDim Ni_blank_value(0 To blank_num - 1) As Double
ReDim Zn_blank_value(0 To blank_num - 1) As Double
ReDim Cr_blank_value(0 To blank_num - 1) As Double
'=================填写空白实验编号End======================

'填写空白实验分析项目 7：Cu 、8：Ni、9：Zn、10：Cr
Dim indexer2 As Integer
indexer2 = 0 '计数器递增用于向列表填入空白值
' 遍历空白字典得到空白所在的行号，再构建空白值的列表,B列为铜的浓度、C为Cr D为Zn E为Ni
' blank_dict的结构为 “id：row”
For Each b in blank_dict.Keys
Cu_blank_value(indexer2) = Sheets("序列").Range("B" & blank_dict(b)).Value
Ni_blank_value(indexer2) = Sheets("序列").Range("E" & blank_dict(b)).Value
Zn_blank_value(indexer2) = Sheets("序列").Range("D" & blank_dict(b)).Value
Cr_blank_value(indexer2) = Sheets("序列").Range("C" & blank_dict(b)).Value
indexer2 =indexer2 + 1
Next
' 填写空白值
For i = 0 To blank_num - 1  Step 1
	Range(Location_index(i) & 5).value = "编号：空白" & i + 1
	' 7为铜的空白所在行，8为Ni、9为Zn、10为Cr
	Range(Location_index(i) & 7).value = Cu_blank_value(i)
	Range(Location_index(i) & 8).value = Ni_blank_value(i)
	Range(Location_index(i) & 9).value = Zn_blank_value(i)
	Range(Location_index(i) & 10).value = Cr_blank_value(i)
Next

' ---------------------------以上为填写空白部分----------------------------------
' ----------------------------以下为填写平行部分----------------------------------

' 平行编号字符串数列 “编号：EN2021052465-01”，用于填写平行的编号标题	
Dim para_list() as String
' 定义结果A与结果B 数列 100mg/kg
Dim Cu_Para_ret_listA() as Integer
Dim Cu_Para_ret_listB() as Integer

Dim Ni_Para_ret_listA() as Integer
Dim Ni_Para_ret_listB() as Integer

Dim Zn_Para_ret_listA() as Integer
Dim Zn_Para_ret_listB() as Integer

Dim Cr_Para_ret_listA() as Integer
Dim Cr_Para_ret_listB() as Integer

' 根据平行数量，定义动态数组，填写平行样分析，
ReDim para_list(0 To parallel_num -1 ) as String
ReDim Cu_Para_ret_listA(0 To parallel_num -1 ) as Integer
ReDim Cu_Para_ret_listB(0 To parallel_num -1 ) as Integer

ReDim Ni_Para_ret_listA(0 To parallel_num -1 ) as Integer
ReDim Ni_Para_ret_listB(0 To parallel_num -1 ) as Integer

ReDim Zn_Para_ret_listA(0 To parallel_num -1 ) as Integer
ReDim Zn_Para_ret_listB(0 To parallel_num -1 ) as Integer

ReDim Cr_Para_ret_listA(0 To parallel_num -1 ) as Integer
ReDim Cr_Para_ret_listB(0 To parallel_num -1 ) as Integer


' 定义铜的浓度为浮点数
Dim Cu_A_cons As Double
Dim Cu_B_cons As Double
' 定义质量，四个元素的质量是一致的，所以不用重复定义
Dim Cu_A_mass As Double
Dim Cu_B_mass As Double
Dim Ni_A_cons As Double
Dim Ni_B_cons As Double
Dim Zn_A_cons As Double
Dim Zn_B_cons As Double
Dim Cr_A_cons As Double
Dim Cr_B_cons As Double
' 定义含水率，四个元素含水率也是一致的
Dim Cu_A_water As Double
' 以下为平行计算过程
Dim indexer As Integer
indexer = 0
' 构建编号字符串的数列、平行结果A、B的数列，从记录平行的字典里得到平行样所在的行号，行号所在为平行B，行号-1为平行A
For Each para in para_dict.Keys
	' para_list数列用于存储平行样的编号，用于填写编号一栏
	para_list(indexer) = "编号：" & Mid(para, 1, Sample_count)
	' 平行样A的铜浓度
	Cu_A_cons = Sheets("序列").Range("B" & para_dict(para)-1).Value
	Cu_B_cons = Sheets("序列").Range("B" & para_dict(para)).Value
	' 平行样A的质量
	Cu_A_mass = Sheets("序列").Range("F" & para_dict(para)-1).Value
	Cu_B_mass = Sheets("序列").Range("F" & para_dict(para)).Value
	' 平行样A的水分
	Cu_A_water = Sheets("序列").Range("G" & para_dict(para)-1).Value
	' 第平行样A的结果值加入至列表
	If Cu_A_cons * 50 / Cu_A_mass / Cu_A_water < 1 Then 
		Cu_Para_ret_listA(indexer) = 0
	Else
		Cu_Para_ret_listA(indexer) = Cu_A_cons * 50 / Cu_A_mass / Cu_A_water
	End If
	' 平行B的结果加入列表
	If Cu_B_cons * 50 / Cu_B_mass / Cu_A_water < 1 Then 
		Cu_Para_ret_listB(indexer) = 0
	Else
		Cu_Para_ret_listB(indexer) = Cu_B_cons * 50 / Cu_B_mass / Cu_A_water
	End If

' -----------------------------------------------------------------------------------
	Ni_A_cons = Sheets("序列").Range("E" & para_dict(para)-1).Value
	Ni_B_cons = Sheets("序列").Range("E" & para_dict(para)).Value

	' 第平行样A的结果值加入至列表
	If Ni_A_cons * 50 / Cu_A_mass / Cu_A_water < 3 Then 
		Ni_Para_ret_listA(indexer) = 0
	Else
		Ni_Para_ret_listA(indexer) = Ni_A_cons * 50 / Cu_A_mass / Cu_A_water
	End If
	' 平行B的结果加入列表
	If Ni_B_cons * 50 / Cu_B_mass / Cu_A_water < 3 Then 
		Ni_Para_ret_listB(indexer) = 0
	Else
		Ni_Para_ret_listB(indexer) = Ni_A_cons * 50 / Cu_A_mass / Cu_A_water
	End If

' --------------------------------------------------------------------------------------
	Zn_A_cons = Sheets("序列").Range("D" & para_dict(para)-1).Value
	Zn_B_cons = Sheets("序列").Range("D" & para_dict(para)).Value
	' 第平行样A的结果值加入至列表
	If Zn_A_cons * 50 / Cu_A_mass / Cu_A_water < 1 Then 
		Zn_Para_ret_listA(indexer) = 0
	Else
		Zn_Para_ret_listA(indexer) = Zn_A_cons * 50 / Cu_A_mass / Cu_A_water
	End If
	' 平行B的结果加入列表
	If Zn_B_cons * 50 / Cu_B_mass / Cu_A_water < 1 Then 
		Zn_Para_ret_listB(indexer) = 0
	Else
		Zn_Para_ret_listB(indexer) = Zn_B_cons * 50 / Cu_B_mass / Cu_A_water
	End If

	Cr_A_cons = Sheets("序列").Range("C" & para_dict(para)-1).Value
	Cr_B_cons = Sheets("序列").Range("C" & para_dict(para)).Value

	If Cr_A_cons * 50 / Cu_A_mass / Cu_A_water < 4 Then 
		Cr_Para_ret_listA(indexer) = 0
	Else
		Cr_Para_ret_listA(indexer) = Cr_A_cons * 50 / Cu_A_mass / Cu_A_water
	End If	
	' 平行B的结果加入列表
	If Cr_B_cons * 50 / Cu_B_mass / Cu_A_water < 4 Then 
		Cr_Para_ret_listB(indexer) = 0
	Else
		Cr_Para_ret_listB(indexer) = Cr_B_cons * 50 / Cu_B_mass / Cu_A_water
	End If	

	indexer = indexer + 1
Next

' 从存储平行结果值的列表中取出结果填入表格
For i = 0 To parallel_num - 1 Step 1 
	' 填写px编号标题 12为标题所在行
	Range(Location_index(i) & 12).value = para_list(i)
	' 填充平行样铜的结果A 14为铜所在行 15为镍 16为锌 17为铬
	Range(Location_index(i) & 14).value = Cu_Para_ret_listA(i)
	' 使用Offset填充平行B
	Range(Location_index(i) & 14).Offset(0,1).value = Cu_Para_ret_listB(i)

	' 填充Ni
	Range(Location_index(i) & 15).value = Ni_Para_ret_listA(i)
	Range(Location_index(i) & 15).Offset(0,1).value = Ni_Para_ret_listB(i)

	' 填充Zn
	Range(Location_index(i) & 16).value = Zn_Para_ret_listA(i)
	Range(Location_index(i) & 16).Offset(0,1).value = Zn_Para_ret_listB(i)

	' 填充Cr
	Range(Location_index(i) & 17).value = Cr_Para_ret_listA(i)
	Range(Location_index(i) & 17).Offset(0,1).value = Cr_Para_ret_listB(i)

Next

' 根据行号得到px样的浓度，约定B列为铜，C列为Cr，D列为Zn、E列为镍、F列为质量、G列为含水率
' --------------------------以上为填写平行部分------------------------




' ----------------------填写加标Start----------------------------------
Dim Cu_para_average() as Integer
Dim Ni_para_average() as Integer
Dim Zn_para_average() as Integer
Dim Cr_para_average() as Integer

Dim Cu_staAdd_ret() as Integer
Dim Ni_staAdd_ret() as Integer
Dim Zn_staAdd_ret() as Integer
Dim Cr_staAdd_ret() as Integer

Dim Cu_staAdd_amount() as Integer
Dim Zn_staAdd_amount() as Integer

Dim staAdd_id() as String
' 定义测定结果值
reDim Cu_para_average(0 To staAdd_num - 1) as Integer
reDim Ni_para_average(0 To staAdd_num - 1) as Integer
reDim Zn_para_average(0 To staAdd_num - 1) as Integer
reDim Cr_para_average(0 To staAdd_num - 1) as Integer

' 定义加标样值
reDim Cu_staAdd_ret(0 To staAdd_num - 1) as Integer
reDim Ni_staAdd_ret(0 To staAdd_num - 1) as Integer
reDim Zn_staAdd_ret(0 To staAdd_num - 1) as Integer
reDim Cr_staAdd_ret(0 To staAdd_num - 1) as Integer
' 定义加标量
reDim Cu_staAdd_amount(0 To staAdd_num - 1) as Integer
reDim Zn_staAdd_amount(0 To staAdd_num - 1) as Integer
' 定义加标的编号标题
reDim staAdd_id(0 To staAdd_num - 1) as String

' 计算加标平均值
Dim indexer4 as Integer
indexer4 = 0

For Each staRow in staAdd_dict.Keys
	' 记录四个元素加标样值
	Cu_staAdd_ret(indexer4) = Sheets("序列").Range("B" & staAdd_dict(staRow)).Value * 50 / Sheets("序列").Range("F" & staAdd_dict(staRow)).value / Sheets("序列").Range("G" & staAdd_dict(staRow)).value
	Ni_staAdd_ret(indexer4) = Sheets("序列").Range("E" & staAdd_dict(staRow)).Value * 50 / Sheets("序列").Range("F" & staAdd_dict(staRow)).value / Sheets("序列").Range("G" & staAdd_dict(staRow)).value
	Zn_staAdd_ret(indexer4) = Sheets("序列").Range("D" & staAdd_dict(staRow)).Value * 50 / Sheets("序列").Range("F" & staAdd_dict(staRow)).value / Sheets("序列").Range("G" & staAdd_dict(staRow)).value
	Cr_staAdd_ret(indexer4) = Sheets("序列").Range("C" & staAdd_dict(staRow)).Value * 50 / Sheets("序列").Range("F" & staAdd_dict(staRow)).value / Sheets("序列").Range("G" & staAdd_dict(staRow)).value

	' 记录加标量,锌的乘2即可
	Cu_staAdd_amount(indexer4) = 0.2 * 50 / Sheets("序列").Range("F" & staAdd_dict(staRow)).value
	Zn_staAdd_amount(indexer4) = 0.4 * 50 / Sheets("序列").Range("F" & staAdd_dict(staRow)).value

	' 测定结果值计算 即 平行的平均值
	' 质量在F列，水分在G列
	Cu_A_mass = Sheets("序列").Range("F" & staAdd_dict(staRow) - 2).Value
	Cu_B_mass = Sheets("序列").Range("F" & staAdd_dict(staRow) - 1).Value
	Cu_A_water = Sheets("序列").Range("G" & staAdd_dict(staRow) ).Value
	Cu_A_cons = Sheets("序列").Range("B" & staAdd_dict(staRow) -2).Value
	Cu_B_cons = Sheets("序列").Range("B" & staAdd_dict(staRow) -1).Value
	Ni_A_cons = Sheets("序列").Range("E" & staAdd_dict(staRow) -2).Value
	Ni_B_cons = Sheets("序列").Range("E" & staAdd_dict(staRow) -1).Value
	Zn_A_cons = Sheets("序列").Range("D" & staAdd_dict(staRow) -2).Value
	Zn_B_cons = Sheets("序列").Range("D" & staAdd_dict(staRow) -1).Value
	Cr_A_cons = Sheets("序列").Range("C" & staAdd_dict(staRow) -2).Value
	Cr_B_cons = Sheets("序列").Range("C" & staAdd_dict(staRow) -1).Value

	Cu_para_average(indexer4) = ((Cu_A_cons * 50 / Cu_A_mass / Cu_A_water) + (Cu_B_cons * 50 / Cu_B_mass / Cu_A_water)) / 2
	Ni_para_average(indexer4) = ((Ni_A_cons * 50 / Cu_A_mass / Cu_A_water) + (Ni_B_cons * 50 / Cu_B_mass / Cu_A_water)) / 2
	Zn_para_average(indexer4) = ((Zn_A_cons * 50 / Cu_A_mass / Cu_A_water) + (Zn_B_cons * 50 / Cu_B_mass / Cu_A_water)) / 2
	Cr_para_average(indexer4) = ((Cr_A_cons * 50 / Cu_A_mass / Cu_A_water) + (Cr_B_cons * 50 / Cu_B_mass / Cu_A_water)) / 2

	If Cu_para_average(indexer4) < 0 Then
		Cu_para_average(indexer4) = 0
	End If
	If Ni_para_average(indexer4) < 0 Then
		Ni_para_average(indexer4) = 0
	End If
	If Zn_para_average(indexer4) < 0 Then
		Zn_para_average(indexer4) = 0
	End If
	If Cr_para_average(indexer4) < 0 Then
		Cr_para_average(indexer4) = 0
	End If
	


	' 记录编号
	staAdd_id(indexer4) = "编号：" & Mid(Sheets("序列").Range("A" & staAdd_dict(staRow)).Value,1,Sample_count)

	indexer4 = indexer4 + 1
Next

' 开始填充
For i = 0 To staAdd_num - 1 Step 1 
	' 填写编号 19为加标编号标题所在行
		Range(Location_index(i) & 19).value = staAdd_id(i)
	' 填写加标量 20为加标量所在行
		Range(Location_index(i) & 20).value = "加标量：Cu、Zn、Cr：" & Cu_staAdd_amount(i) & " mg/kg" & "Zn:" & Zn_staAdd_amount(i) & " mg/kg"
	' 填写测定结果值 铜22行 镍23 锌24 铬25
	' 判断检出限，小于则填充为ND
	If Cu_para_average(i) < 1 AND Cu_para_average(i) <> 0 Then 
	Range(Location_index(i) & 22).value = "ND"
	ElseIf Cu_para_average(i) = 0 Then
	Range(Location_index(i) & 22).value = "/"
	Else
	Range(Location_index(i) & 22).value = Cu_para_average(i)
	End If

	If Ni_para_average(i) < 3 AND Ni_para_average(i) <> 0 Then 
	Range(Location_index(i) & 23).value = "ND"
	ElseIf Ni_para_average(i) = 0 Then
	Range(Location_index(i) & 23).value = "/"
	Else
	Range(Location_index(i) & 23).value = Ni_para_average(i)
	End If

	Range(Location_index(i) & 24).value = Zn_para_average(i)

	If Cr_para_average(i) < 4 AND Ni_para_average(i) <> 0 Then 
	Range(Location_index(i) & 25).value = "ND"
	ElseIf Cr_para_average(i) = 0 Then
	Range(Location_index(i) & 25).value = "/"
	Else
	Range(Location_index(i) & 25).value = Cr_para_average(i)
	End If

	' 填写加标样值
	Range(Location_index(i) & 22).Offset(0,1).value = Cu_staAdd_ret(i)
	Range(Location_index(i) & 23).Offset(0,1).value = Ni_staAdd_ret(i)
	Range(Location_index(i) & 24).Offset(0,1).value = Zn_staAdd_ret(i)
	Range(Location_index(i) & 25).Offset(0,1).value = Cr_staAdd_ret(i)

	' 填写回收率
	Range(Location_index(i) & 22).Offset(0,2).value = ( Cu_staAdd_ret(i) - Cu_para_average(i) ) / Cu_staAdd_amount(i)*100
	Range(Location_index(i) & 23).Offset(0,2).value = ( Ni_staAdd_ret(i) - Ni_para_average(i) ) / Cu_staAdd_amount(i)*100
	Range(Location_index(i) & 24).Offset(0,2).value = ( Zn_staAdd_ret(i) - Zn_para_average(i) ) / Zn_staAdd_amount(i)*100
	Range(Location_index(i) & 25).Offset(0,2).value = ( Cr_staAdd_ret(i) - Cr_para_average(i) ) / Cu_staAdd_amount(i)*100

Next





' ----------------------填写加标End----------------------------------






' -----------------------------以下为填写质控部分----------------------------------
' zk_list存储质控的值
Dim Cu_zk_list() as Double
Dim Ni_zk_list() as Double
Dim Zn_zk_list() as Integer
Dim Cr_zk_list() as Integer
' 定义动态质控数组
ReDim Cu_zk_list(0 to zk_num - 1) As Double
ReDim Ni_zk_list(0 to zk_num - 1) As Double
ReDim Zn_zk_list(0 to zk_num - 1) As Integer
ReDim Cr_zk_list(0 to zk_num - 1) As Integer



' 将质控的结果值填入数 组
Dim indexer3 as Integer
indexer3 = 0
For Each zkkey in zk_dict.Keys
	Cu_zk_list(indexer3) = Sheets("序列").Range("B" & zk_dict(zkkey)).Value * 50 / Sheets("序列").Range("F" & zk_dict(zkkey)).Value
	Ni_zk_list(indexer3) = Sheets("序列").Range("E" & zk_dict(zkkey)).Value * 50 / Sheets("序列").Range("F" & zk_dict(zkkey)).Value
	Zn_zk_list(indexer3) = Sheets("序列").Range("D" & zk_dict(zkkey)).Value * 50 / Sheets("序列").Range("F" & zk_dict(zkkey)).Value
	Cr_zk_list(indexer3) = Sheets("序列").Range("C" & zk_dict(zkkey)).Value * 50 / Sheets("序列").Range("F" & zk_dict(zkkey)).Value
	indexer3 = indexer3 + 1
Next

' 将质控列表的值填入单元格

For i = 0 To zk_num - 1 Step 1 
	' 填写质控编号标题
	Range(Location_index(i) & 27).value = "编号：GBW07554-" & i
	' 填写相应元素的值 铜为29行 镍30 锌31 铬32
	Range(Location_index(i) & 29).value = Cu_zk_list(i)
	Range(Location_index(i) & 30).value = Ni_zk_list(i)
	Range(Location_index(i) & 31).value = Zn_zk_list(i)
	Range(Location_index(i) & 32).value = Cr_zk_list(i)
Next

' --------------------------------以上为填写质控部分-------------------------------------




End Sub


'判断是否含有keyword，传入两个参数，第一个为需要被搜索的字符串,第二个为搜索的字符串
Function checkString(string1, keyword) As Boolean
    ret = InStr(1, string1, keyword, 1)
        If ret <> 0 Then
            checkString = 1
        Else
            checkString = 0
        End If
End Function
